
<?php include('view/template/common/header.tpl'); ?>
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<div class="box">
   <div class="left"></div>
   <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('./view/image/country.png');"><?php echo $heading_title; ?></h1>
    <div class="buttons">
	<a onclick="$('#form').submit();" class="button"><span><?php echo "Lưu Lại"; ?></span></a>
	<a onclick="location = '<?php echo $link_list; ?>';" class="button"><span><?php echo "Hủy"; ?></span></a></div>
   </div>
	 <div class="content">
	    <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
	      <table class="form">
	        <tr>
			<td><?php echo $tenthietkeweb; ?></td>
	        	<td><input  type="text" name="tieu_de" size ="120" value="<?php echo $thietkeweb_detail['tieu_de']; ?>"/></td>
		</tr>
                 
               <tr>
		    <td>Danh mục</td>
		    <td>
	            <select name="cat_id">
                    <option value="0">--Lựa chọn--</option>
                    <?php foreach($list_loaithietkeweb as $tkw){ ?>
	            <?php if($tkw['id']==$thietkeweb_detail['cat_id']) {?>
	            <option value="<?php echo $thietkeweb_detail['cat_id'];?>" selected="selected" ><?php echo $tkw['ten'];?></option>
	            <?php } else { ?>
	            <option value="<?php echo $tkw['id'];?>"><?php echo $tkw['ten'];?></option>
	            <?php } ?>
	            <?php } ?>
	            </select>
	            </td>
              </tr>

              <tr>
		    <td>Nổi bật</td>
		    <td>
	            <select name="status">
                            <?php if($thietkeweb_detail['status']=='0') { ?>
 			    <option value="0">-- Chọn --</option>
	                    <option value="1"> Nổi bật </option>
	                    <option value="0" selected="selected" >Thường</option>
                            <?php } else { ?>
                            <option value="0">-- Chọn --</option>
	                    <option value="1" selected="selected" > Nổi bật </option>
	                    <option value="0">-- Thường --</option>
                            <?php } ?>
                     </select>
	            </td>
              </tr>
             
             
               <tr>
			<td><?php echo $hinhdaidien;?></td>
			<td>
	                <input id="xFilePath" name="avatar" type="text" size="60" value="<?php echo $thietkeweb_detail['avatar']; ?>" />
		        <input type="button" value="Chọn ảnh" onclick="BrowseServer();" /> <br/>
                        <?php if($thietkeweb_detail['avatar']) { ?>
                        <img src ="<?php echo $thietkeweb_detail['avatar'];?>" width= "150" height ="112" class="bimg"/> 
                        <?php } else{?>
                        <img src ="./view/image/noimage.png" width= "150" height ="112" class="bimg"/> 
                        <?php } ?>
                         </td>
		</tr>
	        <tr>
			<td><?php echo $motachung;?></td>
			<td><textarea name="mo_ta_chung" rows="5" cols="150"><?php echo $thietkeweb_detail['mo_ta_chung']; ?></textarea></td>
	        </tr>
	        <tr>
	        	<td><?php echo $motachitiet;?></td>
	     		<td><textarea name="mo_ta_chi_tiet" id="motachitiet"><?php echo $thietkeweb_detail['mo_ta_chi_tiet']; ?></textarea></td>
	        </tr>
                <tr>
			<td><?php echo $tag; ?></td>
	        	<td><input  type="text" name="tag" size ="120"   value="<?php echo $thietkeweb_detail['tag']; ?>"/></td>
		</tr>
                <tr><td><?php echo "Keyword"; ?></td><td><textarea type="text" rows="5" cols="150" name="keyword"><?php echo $thietkeweb_detail['keyword'];?></textarea></td></tr>
	      </table>
	    </form>
	  </div>

	<div class="bottom_button">
		<a onclick="$('#form').submit();" class="button"><span><?php echo "Lưu Lại"; ?></span></a>
		<a onclick="location = '<?php echo $link_list; ?>';" class="button"><span><?php echo "Hủy"; ?></span></a>
	</div>
</div>
<?php include('view/template/common/footer.tpl'); ?>
<script type="text/javascript">
	 var editor = CKEDITOR.replace( 'motachitiet');
         
	 CKFinder.setupCKEditor( editor, './view/javascript/ckfinder/' ) ;
         
</script>

<script type="text/javascript">

function BrowseServer()
{
	// You can use the "CKFinder" class to render CKFinder in a page:
	var finder = new CKFinder();
	finder.basePath = './view/javascript/ckfinder/';	// The path for the installation of CKFinder (default = "/ckfinder/").
	finder.selectActionFunction = SetFileField;
	finder.popup();

	// It can also be done in a single line, calling the "static"
	// popup( basePath, width, height, selectFunction ) function:
	// CKFinder.popup( '../', null, null, SetFileField ) ;
	//
	// The "popup" function can also accept an object as the only argument.
	// CKFinder.popup( { basePath : '../', selectActionFunction : SetFileField } ) ;
}

// This is a sample function which is called when a file is selected in CKFinder.
function SetFileField( fileUrl )
{
	document.getElementById( 'xFilePath' ).value = fileUrl;
}

</script>
